package fr.cephb.operonj.core.db.binding;

import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

import fr.cephb.operonj.core.bio.ChromInfo;

public class ChromInfoBinding extends TupleBinding<ChromInfo>
	{

	@Override
	public ChromInfo entryToObject(TupleInput input)
		{
		return new ChromInfo(
			input.readInt(),
			input.readInt(),
			input.readString(),
			input.readInt(),
			ChromInfo.FLAG.values()[input.readInt()]
			);
		}

	@Override
	public void objectToEntry(ChromInfo c, TupleOutput output)
		{
		output.writeInt(c.getBuildId());
		output.writeInt(c.getChromId());
		output.writeString(c.getName());
		output.writeInt(c.getLength());
		output.writeInt(c.getFlag().ordinal());
		}

	}
